Instance 4Centrality↓:4.972136330038103 Specificity↑:2.5751560882000963
Class620.fromUCD(boolean hexcode,String unidataPath,String outfilePath)#7{
for (String line = inbr.readLine(); line != null; line = inbr.readLine()) {
String[] fields = line.split(";", NUM_FIELDS);
int code = Integer.parseInt(fields[UNICODE], 16);
if (code > maxChar) {
break;
}
if (((fields[GENERAL_CATEGORY].equals("Ll") || fields[GENERAL_CATEGORY].equals("Lu")
|| fields[GENERAL_CATEGORY].equals("Lt"))
&& ("".equals(fields[SIMPLE_LOWERCASE_MAPPING])
|| fields[UNICODE].equals(fields[SIMPLE_LOWERCASE_MAPPING])))
|| fields[GENERAL_CATEGORY].equals("Lo")) {
String[] blockNames = {"Superscripts and Subscripts",
"Letterlike Symbols",
"Alphabetic Presentation Forms",
"Halfwidth and Fullwidth Forms",
"CJK Unified Ideographs",
"CJK Unified Ideographs Extension A",
"Hangul Syllables"};
int j;
for (j = 0; j < blockNames.length; ++j) {
int[] ind = (int[]) blocks.get(blockNames[j]);
if (code >= ind[0] && code <= ind[1]) {
break;
}
}
if (j < blockNames.length) {
continue;
}
int uppercode = -1;
int titlecode = -1;
if (!"".equals(fields[SIMPLE_UPPERCASE_MAPPING])) {
uppercode = Integer.parseInt(fields[SIMPLE_UPPERCASE_MAPPING], 16);
}
if (!"".equals(fields[SIMPLE_TITLECASE_MAPPING])) {
titlecode = Integer.parseInt(fields[SIMPLE_TITLECASE_MAPPING], 16);
}
StringBuilder s = new StringBuilder();
if (hexcode) {
s.append("0x" + fields[UNICODE].replaceFirst("^0+", "").toLowerCase() + " ");
}
s.append(Character.toChars(code));
if (uppercode != -1 && uppercode != code) {
s.append(Character.toChars(uppercode));
}
if (titlecode != -1 && titlecode != code && titlecode != uppercode) {
s.append(Character.toChars(titlecode));
}
ow.write(s.toString() + "\n");
}
}
}
|
|